package com.example.ximalaya.base;

import android.content.Context;
import android.os.Bundle;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;

/*
Android Fragment是Android4.0以上才有的；而FragmentActivity是为了兼容4.0以下版本的Fragment使用的。
androidx使用Fragment
 */
public abstract class BaseFragment extends Fragment {

    private View mRootView;

    //加载onSubViewLoaded的布局
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        //获取子类重写方法返回的view
        mRootView = onSubViewLoaded(inflater, container);
        return mRootView;
    }

    public abstract View onSubViewLoaded(LayoutInflater layoutInflater, ViewGroup container);

}
